  <div class="table-header">
        Danh sách sản phẩm
        <div class="pull-right">
            <a class="btn btn-small btn-success" href='<?php echo site_url("/receipt/addproduct/$receiptId")?>'>Thêm <i class="icon-arrow-right icon-on-right bigger-110"></i></a>
        </div>
    </div>
    <table id="table_report" class="table table-striped table-bordered table-hover dataTable">
        <thead>
            <tr>
                <th>Mã sản phẩm</th>
                <th>Tên sản phẩm</th>
                <th>Số lượng</th>
                <th>Giá</th>
            </tr>
        </thead>
        <tbody>
                  <?php foreach ($lstProduct as $p) { ?>
                    <tr>
                        <td><?php echo $p->ProductId ?></td>
                        <td>
                            
                            <?php echo $p->ProductName ?>
                        
                        </td>
                        <td>
                           <input class="MountReal" type="text" />
                        </td>                        
                        <td>
                           <input data-id='<?php echo $p->Id ?>' type="button" class="btn btn-success btn-save" value="Save" />
                        </td>
                   </tr>
                  <?php } ?>

        </tbody>

    </table>
</div>



<script type="text/javascript">
        $(document).ready(function () {

            // alert('ready');

            $("body").on("click", ".btn-save", function () {

                var id = $(this).attr("data-id");

                var mountReal = $(this).closest('tr').find('.MountReal:first').val();

                var data = {"id": id, "mountReal": mountReal};

                console.log(data);

                $.ajax({
                    url: '<?php echo site_url("/receipt/check_post/")?>' + id + '/' + mountReal,
                    contentType: 'application/json; charset=utf-8',
                    // data: "id="+id+"&mountReal="+mountReal,
                    // data: data,
                    // data: JSON.stringify(data),
                    dataType: 'json',
                    // dataType: 'text',
                    type: "POST"
                }).done(function (response, textStatus, jqXHR) {
                    console.log("done");
                    console.log(response);

                    var htmlFriend = "<li class='notify-require-friend'>"
                                          + "<a>"
                                            + "<button type='button' class='close' aria-hidden='true'>&times;</button>"
                                            + "<p>Bạn đã thực hiện thành công!</p>"
                                          + "</a>"
                                       + "</li>";

                    $("#notify-bottom-left").prepend(htmlFriend);

                    $("#notify-bottom-left li").delay(5000).fadeOut('slow', "swing");

                    new Audio("<?php echo base_url('sound/notify_friend.FLV') ?>").play();                    

                }).fail(function (response, textStatus, jqXHR) {
                    console.log("fail");
                }); // end .ajax
            }); // end on
        }); // end ready

</script>

    <script src='<?php echo base_url("/content/js/jquery.dataTables.min.js") ?>'></script>
    <script src='<?php echo base_url("/content/js/jquery.dataTables.bootstrap.js") ?>'></script>

    <script>
        $(document).ready(function () {

            var oTable = $('#table_report').dataTable({
                "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>"
            });

            // oTable.fnSort([[0, 'desc']]);

        });
    </script>
